package org.malred.jetpackcomposebasic

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import org.malred.jetpackcomposebasic.ui.theme.JetpackComposeBasicTheme

class MainActivity02 : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            MessageCard(Message("androdid", "jetpack compose"))
        }
    }

    @Composable // compose 控件
    fun MessageCard(msg: Message) {
        // compose: 文本控件
        Text(text = msg.author)
        Text(text = msg.body)
    }
}

// 数据类
data class Message(val author: String, val body: String)
